TreeGrid Cells Tutorial
10. Column and row spanning
Attributes RowSpan, Span and Merge
-
Span
attribute specifies how many columns in the row will the cell span.
The row must have set Spanned='1', otherwise the Span attribute is ignored.
-
If you permit column moving by users in spanned grid, it is recommended to define column groups by Group attribute to not let users to break down the spanned cells.
Merge
attribute specifies the cell values which will be shown in the spanned cell.
By default only the first column value is shown in the spanned cell. The Merge contains a list of column names to display their values.
The merged cell values can be displayed in any order.
By MergeEdit attribute is possible to specify the one editable cell from the Merge list.
By MergeFormat is possible to define exact structure how the cell values will be merged and displayed.
By MergeEditFormat specifies exact structure for editing, when more merged cells are editable.
For complex MergeFormat can be defined API event OnMergeChanged for custom parsing edited value instead of default one for given MergeEditFormat.
-
RowSpan
attribute specifies how many rows in the column will the cell span.
The column must have set Spanned='1', otherwise the RowSpan attribute is ignored.
In tree the RowSpan is a count of rows on the same level as this row. All their children are spanned automatically.
The last row’s children are spanned within range when added 0.5 to the RowSpan, e.g. RowSpan=’3.5’ means span for three row and also the last row’s children.
Custom spanned section
can be defined by LeftHtml, MidHtml and RightHtml.
It spans all columns in the section and shows here the HTML code.
Header
can be spanned and row spanned like any other rows.
Every grid contains one main header that is defined by root tag <Header>. You can define more headers by placing next <Header> tags into <Head> section.
To control position of the main header inside the other headers place it also to <Head> tag as <Header id='Header'/>.
-
If used
column paging
(<Cfg ColPaging/> ), the cells can be spanned only inside the column page.
You can set <Cfg ColPagingFixed='0'/> to not page fixed rows and let them span through the whole body.
- To center text inside horizontally spanned cell regardless on scrolling set cell attribute Align='Scroll'.